package com.nanjia.boot.myflow.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nanjia.boot.myflow.deliveryaddressflow.model.entity.DeliveryAddressFlow;
import com.nanjia.boot.myflow.order.dto.OrderDTO;
import com.nanjia.boot.myflow.order.model.entity.Order;
import com.nanjia.boot.myflow.order.model.form.OrderForm;
import com.nanjia.boot.myflow.order.model.query.OrderQuery;
import com.nanjia.boot.myflow.order.model.vo.OrderVO;

import java.util.List;

/**
 * 订单主服务类
 *
 * @author 周洋
 * @since 2025-07-11 11:49
 */
public interface OrderService extends IService<Order> {

    /**
     *订单主分页列表
     *
     * @return {@link IPage<OrderVO>} 订单主分页列表
     */
    IPage<OrderVO> getOrderPage(OrderQuery queryParams);

    /**
     * 获取订单主表单数据
     *
     * @param id 订单主ID
     * @return 订单主表单数据
     */
     OrderForm getOrderFormData(Long id);

    /**
     * 新增订单主
     *
     * @param formData 订单主表单对象
     * @return 是否新增成功
     */
    boolean saveOrder(OrderForm formData);

    /**
     * 修改订单主
     *
     * @param id   订单主ID
     * @param formData 订单主表单对象
     * @return 是否修改成功
     */
    boolean updateOrder(Long id, OrderForm formData);

    /**
     * 删除订单主
     *
     * @param ids 订单主ID，多个以英文逗号(,)分割
     * @return 是否删除成功
     */
    boolean deleteOrders(String ids);

    OrderForm getCartOrderFormByUser(String ipAddr);

    Order createOrder(OrderForm formData, String ipAddr, List<DeliveryAddressFlow> deliveryAddressFlows);

    List<OrderDTO> orderDTOList(OrderQuery queryParams);
}
